roscpp: Fixed remapping of private parameters in anonymous nodes #2325
+134
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2324.
This fix runs all private name remaps through another round of remapping after the anonymous node name is finished. The first remapping round is done with incomplete node name, which resulted in inability to remap private names for anonymous nodes without
__name:=
arg.The new behavior corresponds to what rospy is doing.
The impact on existing code should be close to zero. Anything launched from a launch file will not be affected. The only affected usages are manual
rosrun
commands (and if somebody does some crazy things aroundros::init()
).I did not find a good way to remove the wrong remappings, so they remain there. I.e.
g_remappings
will contain both/node/topic->newtopic
and/node_12321321/topic->newtopic
. This isn't correct, but it could actually serve as a backwards compatibility feature for the case if someone was working around #2324 by explicitly remapping the incomplete name.Real-world tools affected by #2324 can be found e.g. here: http://docs.ros.org/en/latest/api/cras_topic_tools/html/classcras_1_1ThrottleMessagesNodelet.html#details . It is an improved version of
topic_tools throttle
which, if no topic args are given through CLI, subscribes to~input
topic. When running asrosrun cras_topic_tools throttle ~input:=/remapped
, the remap does not happen without this PR. Appending__name:=foo
makes the remap happy, which is confusing.